//
//  NSObject+AutoCancelCategory.m
//  NetworkDemo
//
//  Created by 万孟超 on 2021/9/7.
//

#import "NSObject+AutoCancelCategory.h"
#import <objc/runtime.h>

@implementation NSObject (AutoCancelCategory)

/// 动态添加NSObject属性
- (NetworkAutoCancelModel *)networkAutoCancel {
    NetworkAutoCancelModel *cancelModel = objc_getAssociatedObject(self, @selector(networkAutoCancel));
    if (!cancelModel) {
        cancelModel = [[NetworkAutoCancelModel alloc] init];
        objc_setAssociatedObject(self, @selector(networkAutoCancel), cancelModel, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    return cancelModel;
}

@end
